Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

250
Views
javascript - console.log prints an array with its brackets " [ ]" and not just the content

I have this code

var family = ["Jullia", "James", "Eva"];
console.log(family);

And as you can see, when you run the code, it prints the brackets as well. Why?

(I am new to javascript so i know that this might seem like a stupid question to ask..)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is simply how your console has chosen to represent arrays—by writing each element enclosed in brackets. It helps the programmer know that what has been printed is an array of elements. I would not rely on this "stringified" version, though, if you're trying to print names in a specific way.

To do that, I would suggest learning about Array.join() (reference), where the examples do exactly as you might want.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!